import request from '@/utils/request'

// 查询营销订单维护列表
export function listSom(query) {
  return request({
    url: '/marketing/som/list',
    method: 'get',
    params: query
  })
}

// 查询营销订单维护详细
export function getSom(somId) {
  return request({
    url: '/marketing/som/' + somId,
    method: 'get'
  })
}

// 新增营销订单维护
export function addSom(data) {
  return request({
    url: '/marketing/som',
    method: 'post',
    data: data
  })
}

// 修改营销订单维护
export function updateSom(data) {
  return request({
    url: '/marketing/som',
    method: 'put',
    data: data
  })
}

// 删除营销订单维护
export function delSom(somId) {
  return request({
    url: '/marketing/som/' + somId,
    method: 'delete'
  })
}
// 修改营销订单状态
export function updateSomZtbz(somId, mustZtbz, newZtbz) {
  return request({
    url: '/marketing/som/updateSomZtbz/' + somId + '/' + mustZtbz + '/' + newZtbz,
    method: 'put'
  })
}
// 通过Id批量更新营销单备注
export function updateRemarkBySomIds(somIds, remark) {
  return request({
    url: '/marketing/som/updateRemarkBySomIds/' + somIds + '/' + remark,
    method: 'put',
  })
}

// 导出营销订单维护
export function exportSom(query) {
  return request({
    url: '/marketing/som/export',
    method: 'get',
    params: query
  })
}

//
export function importSomMstr(data) {
  return request({
    url: '/marketing/som/importSom',
    method: 'post',
    data: data
  })
}

//下载营销单模板
export function exportSomExample() {
  return request({
    url: '/marketing/som/exportSomExample',
    method: 'get',
  })
}

//根据营销订单获取其详情
export function getSomBySomDjbh(query) {
  return request({
    url: '/marketing/som/getSomBySomDjbh/' + query,
    method: 'get',
  })
}

export function addScSom(data) {
  return request({
    url: '/marketing/som/addScSom',
    method: 'post',
    data: data
  })
}



//超发记录表
export function listTempSom(query) {
  return request({
    url: '/marketing/som/listTempSom',
    method: 'get',
    params: query
  })
}
//超发记录表-报表
export function listTempSomReport(query) {
  return request({
    url: '/marketing/som/listTempSomReport',
    method: 'get',
    params: query
  })
}

//未自动结案工单-报表
export function listSomMstrByTypeAndZtbz(query) {
  return request({
    url: '/marketing/som/listSomMstrByTypeAndZtbz',
    method: 'get',
    params: query
  })
}
//未自动结案工单-报表
export function listSomCountByTypeAndZtbz(query) {
  return request({
    url: '/marketing/som/listSomCountByTypeAndZtbz',
    method: 'get',
    params: query
  })
}//未自动结案工单-报表导出
export function exportReport(query) {
  return request({
    url: '/marketing/som/NonAutoCloseWorkOrderExport',
    method: 'get',
    params: query
  })
}

/**
 * 营销订单撤回
 */
export function marketingRollback(data) {
  return request({
    url: '/marketing/som/rollback',
    method: 'put',
    data: data
  })
}

